//pizza
package ${model.packageName};

import java.util.List;

<#list model.importList as import>
import ${import};	
</#list>


public class ${model.actionClassName} extends BaseAction{
	
	private ${model.className} ${model.objName};
	private ${model.pkType} id;
	private List<${model.className}> ${model.objName}List;
	<#list model.manyTOoneList as manyTOone>
	private List<${manyTOone.className}> ${manyTOone.objName}List;
	</#list>
	
	${model.actionClassName}(){
		nameSpace="${model.actionNameSpace}";
	}
	
	public String admin(){
		totalProperty=${model.objName}Service.getCount();
		${model.objName}List=${model.objName}Service.findAll(start,limit);
		return SUCCESS;
	}
	
	public String edit(){
		<#list model.manyTOoneList as manyTOone>
		${manyTOone.objName}List=${manyTOone.objName}Service.findAll();
		</#list>
		if(id!=null){
			${model.objName}=(${model.className}) ${model.objName}Service.findById(id);
		}
		return SUCCESS;
	}
	
	public String del(){
		if(${model.objName}Service.delete(${model.objName}Service.findById(id))){
			nextAction="admin";
			return NEXT;
		}
		return ERROR;
	}
	
	
	public String save(){
		if(${model.objName}Service.saveOrUpdate(${model.objName})!=null){
			nextAction="admin";
			return NEXT;
		}
		return ERROR;
	}	

	public ${model.pkType} getId() {
		return id;
	}

	public void setId(${model.pkType} id) {
		this.id = id;
	}

	public ${model.className} get${model.className}() {
		return ${model.objName};
	}

	public void set${model.className}(${model.className} ${model.objName}) {
		this.${model.objName} = ${model.objName};
	}
	
	public List<${model.className}> get${model.className}List() {
		return ${model.objName}List;
	}

	public void set${model.className}List(List<${model.className}> ${model.objName}List) {
		this.${model.objName}List = ${model.objName}List;
	}

	
	<#list model.manyTOoneList as manyTOone>
	public List<${manyTOone.className}> get${manyTOone.className}List() {
		return ${manyTOone.objName}List;
	}

	public void set${manyTOone.className}List(List<${manyTOone.className}> ${manyTOone.objName}List) {
		this.${manyTOone.objName}List = ${manyTOone.objName}List;
	}
	</#list>

}

